home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
drdobbs
/
1987
/
06
/
bbs.l5
< prev
next >
Wrap
Text File
|
1987-05-05
|
1KB
|
71 lines
Listing Five
send
1 echo 'who am i | cut -f1 -d" " ' 'date | cut -c1-16' "send" >>/u/bbs/log.file
2 SCAN=/u/bbs/msg/.index
3 LAST=/u/bbs/.last
4 MSG=/u/bbs/msg
5 L='cat $LAST'
6 D='date'
# increment the number of the last message entered
7 L='expr $L + 1'
# save the new "last message" value
8 echo $L >$LAST
9 echo
# collect message header information
10 echo "To: \c"
11 read to
12 echo "Subject: \c"
13 read subject
14 echo "From: \c"
15 read who
16 trap 'rm -f $MSG/$L;continue' 2 3
17 ech
18 echo "Start typing your message. You have 20 lines available."
19 echo "Type a period on a new line to end the message."
20 echo
# store the message header in the message file
21 echo "# $L From: $who $D" >$MSG/$L
22 echo " To: $to" >>$MSG/$L
23 echo " Subject: $subject" >>$MSG/$L
24 echo >>$MSG/$L
# collect the body of the message
25 NL=0
26 read newline
27 while [ "$newline" != "." -a "$NL" -lt 20 ]
28 do
29 echo $newline >>$MSG/$L
30 NL='expr $NL + 1'
31 read newline
32 done
33 echo
# update the message index for use by the scan command
34 echo "Message being posted, please wait... \c"
35 echo "# $L From: $who $D" >>$MSG/temp
36 echo " To: $to" >>$MSG/temp
37 echo " Subject: $subject" >>$MSG/temp
38 echo " " >>$MSG/temp
39 cat $SCAN >>$MSG/temp
40 mv $MSG/temp $SCAN
41 echo